package com.evan.common.service.impl;

import com.evan.common.dao.ClusterDao;
import com.evan.common.pojo.Cluster;
import com.evan.common.service.ClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ClusterServiceImpl implements ClusterService {

    @Autowired
    ClusterDao cd;

    @Override
    public List<Cluster> getAllCluster() {
        return cd.findAll();
    }

    @Override
    public void addCluster(Cluster cluster) {
        cd.save(cluster);
    }

    @Override
    public Optional<Cluster> getClusterByCid(Integer cid) {
        return cd.findById(cid);
    }
}
